﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Fis.Service.Forms
{
    public partial class SaveEditForm : EditBaseForm
    {
        public SaveEditForm()
        {
            InitializeComponent();
            //RightsSetup();
        }

        protected virtual void RightsSetup()
        {
            if (Fis.Win.Utils.AppSession.UserInfo["FRIGHTS"].ToString() == "1")
            {
                barButtonItem3.Visibility = DevExpress.XtraBars.BarItemVisibility.Always;
            }
            else
            {
                barButtonItem3.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
            }
        }

        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            SaveAndClose();
        }

        private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            SaveAndNew();
        }

        private void barButtonItem3_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (Fis.Win.Utils.AppSession.UserInfo["FRIGHTS"].ToString() == "1")
            {
                Audit();
            }
            else
            {
                DevExpress.XtraEditors.XtraMessageBox.Show("请使用主管身份登录进行操作");
            }
        }

        protected virtual void SaveAndClose() { }
        protected virtual void SaveAndNew() { }
        protected virtual void Audit() { }

        private void SaveEditForm_Load(object sender, EventArgs e)
        {
        }
    }
}
